// 封装项目常用的工具函数
// 封装缓存数据的获取与设置
export function setSession (name, data) {
    let res = JSON.stringify(data)
    sessionStorage.setItem(name, res)
}

export function getSession (name) {
    let res = sessionStorage.getItem(name)
    return JSON.parse(res)
}


// 节流
export function delayPrint (delay, callback) {
    let timer = null;
    return function () {
        if (timer) {
            clearInterval(timer);
        }

        timer = setTimeout(function () {
            callback();
        }, delay);
    };
}

